<?php

namespace app\api\library;

class UnauthorizedException extends \RuntimeException
{
    protected $error;
    protected $statusCode;

    public function __construct($error, $statusCode = 401)
    {
        $this->error   = $error;
        $this->message = is_array($error) ? implode("\n\r", $error) : $error;
        $this->statusCode    = $statusCode;
    }

    /**
     * @access public
     * @return int
     */
    public function getStatusCode()
    {
        return $this->statusCode;
    }

    /**
     * @access public
     * @return array|string
     */
    public function getError()
    {
        return $this->error;
    }
}